home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 255_01 / gpwtrow.asm < prev    next >
Encoding:
Assembly Source File  |  1988-03-28  |  2.6 KB  |  86 lines

  1.           page   80,132
  2.           page
  3. ;
  4. ;         Kent Cedola
  5. ;         2015 Meadow Lake Court
  6. ;         Norfolk, Virginia  23518
  7. ;
  8.  
  9. dgroup    group  _data
  10.  
  11. _data     segment word public 'data'
  12.           assume ds:dgroup
  13.  
  14.           extrn  _gdmerge:byte
  15.           extrn  _gdcur_x:word,_gdcur_y:word
  16.           extrn  _gdvw_x1:word,_gdvw_x2:word,_gdvw_x3:word
  17.           extrn  _gdvw_y1:word,_gdvw_y2:word,_gdvw_y3:word
  18.           extrn  _gdc_flg:byte
  19.  
  20. _data     ends
  21.  
  22. _text     segment byte public 'code'
  23.  
  24.           assume cs:_text,ds:dgroup
  25.           public _gpwtrow
  26. _gpwtrow  proc   near
  27.  
  28.           push   bp
  29.           mov    bp,sp
  30.           push   si
  31.           push   di
  32.  
  33.           mov    ax,_gdcur_y           ; Compute the segment of the graphic
  34.           shl    ax,1                  ;   byte that is to be changed
  35.           shl    ax,1                  ;   ES = A000 + (80 * Y) / 16;
  36.           add    ax,_gdcur_y           ;   ...
  37.           add    ax,0A000h             ;   ...
  38.           mov    es,ax                 ;   ...
  39.           mov    di,_gdcur_x           ; Compute the column byte offset
  40.           mov    cx,di                 ;   ... (Save for later)
  41.           shr    di,1                  ;   DI = X / 8;
  42.           shr    di,1                  ;   ...
  43.           shr    di,1                  ;   ...
  44.           mov    dx,03CEh              ; Load graphic controller's address port
  45.           mov    ah,_gdmerge
  46.           mov    al,3
  47.           out    dx,ax
  48.           mov    ax,0205h
  49.           out    dx,ax
  50.           mov    al,8                  ; Mask value is in address eight (8)
  51.           out    dx,al                 ; Point to the mask register
  52.           inc    dx                    ; Bump port addr to the mask register
  53.           mov    al,80h                ; Compute mask byte to change one bit
  54.           and    cl,7                  ;   ...  (It has to be done this way to
  55.           ror    al,cl                 ;   ...   use merge value in write)
  56.  
  57.           mov    cx,[bp+6]
  58.           mov    si,[bp+4]
  59. nextbit:
  60.           out    dx,al
  61.           mov    ah,[si]
  62.           inc    si
  63.           mov    bh,es:[di]
  64.           mov    es:[di],ah
  65.           ror    al,1
  66.           adc    di,0
  67.           loop   nextbit
  68.  
  69.           mov    al,0FFh
  70.           out    dx,al                 ; Restore the mask byte (for text)
  71.           dec    dx
  72.           mov    ax,5
  73.           out    dx,ax
  74.           mov    ax,3
  75.           out    dx,ax
  76.  
  77.           pop    di
  78.           pop    si
  79.           pop    bp
  80.           ret
  81.  
  82. _gpwtrow  endp
  83.  
  84. _text     ends
  85.           END
  86.